package com.kaibes.imserver.model.data;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.json.JSONObject;

public class UserinformationData {

	private ResultSet resultSet;
	private String username, nickname, photo, sex, job, company, school,
			address, hometown, email, signature, introduction, birth;

	public UserinformationData(ResultSet resultSet) {
		this.resultSet = resultSet;
		init();
	}

	private void init() {
		try {
			if (resultSet.next()) {
				username = resultSet.getString("username");
				nickname = resultSet.getString("nickname");
				photo = resultSet.getString("photo");
				sex = resultSet.getString("sex");
				birth = resultSet.getString("birth");
				signature = resultSet.getString("signature");
				introduction = resultSet.getString("introduction");
				job = resultSet.getString("job");
				company = resultSet.getString("company");
				school = resultSet.getString("school");
				address = resultSet.getString("address");
				hometown = resultSet.getString("hometown");
				email = resultSet.getString("email");
			}
			resultSet.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public JSONObject getJSONObject() {
		JSONObject jsonObject = new JSONObject();
		jsonObject.put("username", username);
		jsonObject.put("nickname", nickname);
		jsonObject.put("photo", photo);
		jsonObject.put("sex", sex);
		jsonObject.put("birth", birth);
		jsonObject.put("signature", signature);
		jsonObject.put("introduction", introduction);
		jsonObject.put("job", job);
		jsonObject.put("company", company);
		jsonObject.put("school", school);
		jsonObject.put("address", address);
		jsonObject.put("hometown", hometown);
		jsonObject.put("email", email);
		return jsonObject;
	}
	
	public ResultSet getResultSet() {
		return resultSet;
	}

	public void setResultSet(ResultSet resultSet) {
		this.resultSet = resultSet;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getPhoto() {
		return photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getJob() {
		return job;
	}

	public void setJob(String job) {
		this.job = job;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getSchool() {
		return school;
	}

	public void setSchool(String school) {
		this.school = school;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getHometown() {
		return hometown;
	}

	public void setHometown(String hometown) {
		this.hometown = hometown;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getSignature() {
		return signature;
	}

	public void setSignature(String signature) {
		this.signature = signature;
	}

	public String getIntroduction() {
		return introduction;
	}

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	public String getBirth() {
		return birth;
	}

	public void setBirth(String birth) {
		this.birth = birth;
	}

}
